jsMath

Matrice

""" Zeljka Strmecki """ 
       
A=matrix(Zmod(4) , [[1,2,3],[4,5,6],[7,8,9]]); A 
       
[1 2 3]
[0 1 2]
[3 0 1]
A.parent() 
       
Full MatrixSpace of 3 by 3 dense matrices over Ring of integers
modulo 4
type(A) 
       
<type 'sage.matrix.matrix_modn_dense.Matrix_modn_dense'>
C=random_matrix(Zmod(5) , 2,5); C 
       
[1 2 3 3 2]
[3 1 3 4 0]
A[0,2]=9; A 
       
[1 2 1]
[0 1 2]
[3 0 1]
D=matrix(Zmod(5) , 3 ,3 ,srange(9)); D 
       
[0 1 2]
[3 4 0]
[1 2 3]
B=matrix(RR , [[2.3 , sqrt(2)] , [4.5 ,3.4]]); B 
       
[2.30000000000000 1.41421356237310]
[4.50000000000000 3.40000000000000]
B.parent(); 
       
Full MatrixSpace of 2 by 2 dense matrices over Real Field with 53
bits of precision
E=random_matrix(CC , 2, 2); E 
       
[ 0.225098536879536 + 0.802027631995780*I  0.432082082284599 +
0.447487209488795*I]
[ 0.447401588322589 - 0.713313238504098*I 0.696233919581316 -
0.0486883232758692*I]
F=matrix(QQ , [[2.3 , sqrt(2)] , [4.5 ,3.4]]); F 
       
Traceback (click to the left of this block for traceback)
...
TypeError: unable to convert sqrt(2) to a rational
G=matrix(QQ , [[2.3 , 3.4] , [4.5 ,3.4]]); G 
       
[23/10  17/5]
[  9/2  17/5]
#matrice nad prstenom polinoma 
       
R.<x,y>=QQ[] 
       
m=matrix(2 , [x , x^2+y , 2/3*y^2-x , x]); m 
       
[          x     x^2 + y]
[2/3*y^2 - x           x]
m(2,4) 
       
[   2    8]
[26/3    2]
reset('m') 
       
m(sqrt(2 ), 3.4) 
       
Traceback (click to the left of this block for traceback)
...
NameError: name 'm' is not defined